package beans;

//~--- non-JDK imports --------------------------------------------------------

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

//~--- JDK imports ------------------------------------------------------------

import javax.servlet.http.HttpServletRequest;

public class LoginActionForm extends org.apache.struts.action.ActionForm {
    String password;
    String username;

    public LoginActionForm() {}

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void reset(ActionMapping actionMapping, HttpServletRequest request) {

        // TODO: Write method body
    }

    public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {

        // TODO: Write method body
        ActionErrors errors = new ActionErrors();

        if ((username == null) || username.equals("")) {
            errors.add("UserNameError", new ActionMessage("EmptyUserName"));
        }

        if ((password == null) || (password == (""))) {
            errors.add("UserPasswordError", new ActionMessage("EmptyUserPassword"));
        }

        return errors;
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
